﻿using System;
using System.IO;

namespace ExtractTextFromTags
{
    class ExtractTextFromTags
    {
        static void Main()
        {
            bool InsideTag = false;
            int charNumber;

            using (StreamWriter writer = new StreamWriter("..\\..\\Result.txt"))
            {
                using (StreamReader reader = new StreamReader("..\\..\\File.txt"))
                {
                    while ((charNumber = reader.Read()) != -1)
                    {
                        char ch = (char)charNumber;
                        if (ch == '>')
                        {
                            InsideTag = true;
                            continue;
                        }
                        else if (ch == '<')
                        {
                            InsideTag = false;
                            continue;
                        }

                        if (InsideTag)
                        {
                            writer.Write((char)charNumber);
                        }
                    }
                }
            }
        }
    }
}
